require('../models/publish.js');
var _            = require('lodash');
var mongoose  = require('mongoose');
var Publish = mongoose.model('Publish');

//根据发布配置id获取该配置发布记录
exports.getPublishRec = function(publish_config_id,cb){
    Publish.find({'publish_config':publish_config_id},cb);
};
exports.addPublishInfo = function(publish_info,cb){
    var info = new Publish(publish_info);
    info.save(cb);
};

exports.deletePublishRec = function(publish_id,cb){
    Publish.remove({_id:{ $in: publish_id}},cb);
};

exports.updatePublishState = function(id,state,cb){
    Publish.update({_id:id},{ state:state}, cb);
};
